<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title>showData</title>
  <link rel="stylesheet" type="text/css" href="showData.css"/>
  <script src="Scripts/jquery-1.5.1.js" type="text/javascript"></script>
  <script type="text/javascript" language="JavaScript">

  $(function () {
      getCurrentDb();
      showAllTheData();
     });


  function getCurrentDb() {
      //打开数据库，或者直接连接数据库参数：数据库名称，版本，概述，大小
      var db = openDatabase("myDb", "1.0", "it's to save register data!", 1024 * 1024); ;
      return db;
       
  }



  function showAllTheData() {
            $("#tblData").empty();
            var db = getCurrentDb();

            db.transaction(function (trans) {
                trans.executeSql("select * from Register ", [], function (ts, data) {
                    if (data) {
                        for (var i = 0; i < data.rows.length; i++) {
                            appendDataToTable(data.rows.item(i));//获取某行数据的json对象
                        }
                    }
                }, function (ts, message) {
                    alert(message);
                    var tst = message;
                });

            });
        }

        function appendDataToTable(data) {//将数据展示到表格里面
            //uName,title,words
            var txtName = data.userName;
            var txtEmail = data.userEmail;
            var txtPassword = data.userPassword;
            
            var strHtml = "";
            strHtml += "<tr>";
            strHtml += "<td>"+txtName+"</td>";
            strHtml += "<td>" + txtEmail + "</td>";
            strHtml += "<td>" + txtPassword + "</td>";
            strHtml += "</tr>";
            $("#tblData").append(strHtml);
        }

  </script>
<!-- <link rel="stylesheet" type="text/css" href="register.css" /> -->
</head>


        <table id="tblData">
      
        </table>

</body>
</html>